home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 January / macformat46.iso / Shareware Plus / Developers / Library / Grant's CGI Framework / Grant's CGI Framework / Project Files / MyConfiguration.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-20  |  12.5 KB  |  369 lines

  1. #pragma once
  2. /*****
  3.  *
  4.  *    MyConfiguration.h
  5.  *
  6.  *    You will want to modify the constants in this header file to
  7.  *    set the code to compile with the particular options you want.
  8.  *    Use 1 (one) to turn an option on, 0 (zero) to turn it off.
  9.  *
  10.  *    I've marked recent additions to this file with
  11.  *        •new•
  12.  *    in a comment.
  13.  *
  14.  *    This is a support file for "Grant's CGI Framework".
  15.  *    Please see the license agreement that accompanies the distribution package
  16.  *    for licensing details.
  17.  *
  18.  *    Copyright ©1995,1996 by Grant Neufeld
  19.  *    grant@acm.com
  20.  *    http://arpp.carleton.ca/cgi/framework/
  21.  *
  22.  *****/
  23.  
  24. #ifndef __MYCONFIGURATION_H__
  25. #define __MYCONFIGURATION_H__
  26.  
  27. #include "constants.h"
  28.  
  29.  
  30. /***  CONFIGURATION OPTIONS  ***/
  31.  
  32. /**  THREADS  **/
  33.  
  34. /* if off, the thread manager must be present for the app to run */
  35. #define kCompileWithThreadsOptional        1
  36. /* if on, all Apple Events (including the CGI sdoc event) will be
  37.     spawned off as separate threads. If off, you are on your own for
  38.     threading the CGI events. */
  39. #define kCompileWithThreadedAppleEvents    1
  40. /* number of threads to preallocate; used by startupThreads.
  41.     If you've turned off kCompileWithThreadedAppleEvents and make no
  42.     calls to the MyNewThreadFromPool function, you'll probably want to
  43.     set this to zero */
  44. #define kStartupThreadsPreallocate        5
  45.  
  46.  
  47. /**  QUITTING  **/
  48.  
  49. /* if on, app will try to quit after a set time of idling */
  50. #define kCompileWithQuitOnLongIdle        1
  51. /* the amount of idle time, in ticks (60ths of a second), before
  52.     the application self quits. 60*60 is one minute in ticks. */
  53. #define kIdleTimeToQuit                    (5 * kOneMinuteInTicks)
  54. /* if on, application will quit on idle if it was opened
  55.     normally (e.g. via the Finder - starts off by receiving an
  56.     OpenApplication AppleEvent) */
  57. #define kCompileWithIdleQuitOnOpenApp    1
  58. /* if memory gets 'precariously' low, the application will be set to quit.
  59.     This _may_ (note: untested) speed up the application. Needs profiling */
  60. #define kCompileWithQuitOnLowMemory        1
  61.  
  62.  
  63. /**  Modules  (CGI/ListSTAR)  **/
  64.  
  65. /* the following determine which modules are compiled */
  66. /* CGI */
  67. #define kCompileWithCGICode                1
  68. /* ListSTAR */
  69. #define kCompileWithListSTARCode        0
  70. /* TCP (OpenTransport or MacTCP) */
  71. #define kCompileWithTCPCode                0
  72.  
  73.  
  74. /**  CGI Support  **/
  75.  
  76. /* Send-partial event support (cgiAESendPartial).
  77.     Also includes the connection field of the CGIRecord. */
  78. #define kCompileWithCGISendPartial        0
  79. /* Form handling code (all the CGIFormFields... functions).
  80.     If you turn this off, the formFields and totalFields will not
  81.     be available in the CGIHandles. */
  82. #define kCompileWithCGIFormHandling        1
  83. /* automatically format form data before calling MyCGIProcess. */
  84. #define kCompileWithCGIFormAutoProcess    1
  85. /* automatically decode parameters (convert %xx values, and special chars)
  86.     Parameters affected: path_args, http_search_args */
  87. #define kCompileWithCGIAutoDecode        1
  88. /* Used for backwards compatibility - if you have old code that
  89.     uses the responseData field of the CGIRecord (CGIHdl) structure as
  90.     a 'char *', turn off this flag (set to zero). Otherwise, just leave
  91.     it on (set to 1). If you update your old code to use responseData as
  92.     a Handle, then set this on. */
  93. #define kCompileWithCGIResponseDataAsHandle    1
  94. /* •new•15 if this is option is set, the framework will generate an
  95.     http error header if you do not set responseData in the CGIHdl.
  96.     Turning this option off is really only useful if you want to build
  97.     a Preprocessor CGI which will need to return no data if it wishes
  98.     to indicate to the server that the preprocessor did not handle the
  99.     cgi event, and that that event should be passed along to normal
  100.     processing. */
  101. #define kCompileWithCGINoDataHTTPError    1
  102.  
  103. #if kCompileWithCGISendPartial
  104. /* Send Partial support requires the action field */
  105. #define kCompileWithCGIActionSupport 1 /* don't touch */
  106. #else
  107.  
  108. /* support use as a user defined action */
  109. #define kCompileWithCGIActionSupport    1
  110. #endif
  111.  
  112. /**  CGI Parameters  **/
  113.  
  114. /* If you want to link your own data into the CGIHdl, use the
  115.     'refCon' field (a long value) to store custom data. */
  116. #define kCompileWithCGIRefCon            1
  117.  
  118. /* '----' path_args            */
  119. #define kCompileWithCGIpath_args        1
  120. /* 'kfor' http_search_args    */
  121. #define kCompileWithCGIhttp_search_args    1
  122. /* 'user' username            */
  123. #define kCompileWithCGIusername            1
  124. /* 'pass' password            */
  125. #define kCompileWithCGIpassword            1
  126. /* 'frmu' from_user            */
  127. #define kCompileWithCGIfrom_user        1
  128. /* 'addr' client_address    */
  129. #define kCompileWithCGIclient_address    1
  130. /* 'post' post_args            */
  131. #define kCompileWithCGIpost_args        1
  132. /* 'meth' method            */
  133. #define kCompileWithCGImethod            1
  134. /* 'svnm' server_name        */
  135. #define kCompileWithCGIserver_name        1
  136. /* 'svpt' server_port        */
  137. #define kCompileWithCGIserver_port        1
  138. /* 'scnm' script_name        */
  139. #define kCompileWithCGIscript_name        1
  140. /* 'ctyp' content_type        */
  141. #define kCompileWithCGIcontent_type        1
  142. /* •new•15 'CLen' content_length    */
  143. #define kCompileWithCGIcontent_length    1
  144. /* 'refr' referer            */
  145. #define kCompileWithCGIreferer            1
  146. /* 'Agnt' user_agent        */
  147. #define kCompileWithCGIuser_agent        1
  148. /* 'Kcip' client_ip            */
  149. #define kCompileWithCGIclient_ip        1
  150. /* 'Kfrq' full_request        */
  151. #define kCompileWithCGIfull_request        1
  152.  
  153. #if kCompilingForWSAPI
  154. /* these fields are only available to WSAPI plug-ins */
  155. /* •new•15  */
  156. #define kCompileWithCGIfileMIMEType        1
  157. /* •new•15  */
  158. #define kCompileWithCGIserverField        1
  159. /* •new•15  */
  160. #define kCompileWithCGIserverDirectoryPath    1
  161. /* •new•15  */
  162. #define kCompileWithCGIurlPhysicalPath    1
  163. /* •new•15  */
  164. #define kCompileWithCGIifModifiedSince    1
  165. /* •new•15  */
  166. #define kCompileWithCGIcurrentRealm        1
  167. #endif /* kCompilingForWSAPI */
  168.  
  169. //• this isn't actually a parameter of the CGI event, so I've removed it
  170. ///* 'Pvrs' version            */
  171. //#define kCompileWithCGIversion    0
  172.  
  173.  
  174. /**  INTERFACE  **/
  175.  
  176. /* setting this to off will create a background only application with
  177.     no user interface. The application won't show up in the
  178.     application menu. */
  179. #define kCompileWithForeground            1
  180. #if kCompileWithForeground /* only allow the options below if foreground */
  181.  
  182. /* setting this on will allow user interface elements such as error 
  183.     dialogs to pop up. Turn it off if you want the application to be able
  184.     to run without requiring any user interaction. User interface elements
  185.     such as menus will still be available (providing CompileWithForeground
  186.     is on). */
  187. #define    kCompileWithFullUserInterface    0    
  188. /* display the splash screen on startup */
  189. #define kCompileWithSplashScreen        0
  190. /* application uses modeless dialogs - required if you are supporting
  191.     url clicking in your about box */
  192. #define kCompileWithModelessDialogs        1
  193. /* application uses custom windows */
  194. #define kCompileWithApplicationWindows    0
  195. /* application handles custom keyboard entry */
  196. #define kCompileWithKeyboardEvents        0
  197. /* support drag and drop manager */
  198. #define kCompileWithDragNDrop            0
  199.  
  200. /* •new• support url clicking for download in the about box */
  201. #define kCompileWithAboutURL            1
  202.  
  203. #endif /* kCompileWithForeground */
  204.  
  205.  
  206. /***  MENUS  ***/
  207.  
  208. /* •new•15 Include the Options menu (required for preferences dialog)
  209.     note that if you turn this off, you'll need to modify MBAR 128 in
  210.     "Menus.rsrc" to not include Menu res ID 131. You will also want to
  211.     delete MENU 131. */
  212. #define kCompileWithMenuOptions            1
  213.  
  214.  
  215. /***  PROCESS / APPLICATION  ***/
  216.  
  217. /* If this is defined, the application will have a global 'gProcessFSSpec'
  218.     that is automatically, during startup, set to be the application's
  219.     file spec. */
  220. #define kCompileWithProcessFileSpec        1
  221. /* default setting for the sleep time passed to functions such as
  222.     WaitNextEvent */
  223. #define kSleepTicks                        (2 * kOneSecondInTicks)
  224. /* default setting for the sleep time passed to functions such as
  225.     WaitNextEvent when the application is busy with tasks */
  226. #define kSleepTicksWhenBusy                5
  227. /* •new•15 set this on if you want to support the CustomPeriodicTask
  228.     function which allows you to have tasks processed, outside of
  229.     CGI events, on a periodic basis. */
  230. #define kCompileWithPeriodicTask        0
  231. /* •new•15 amount of time to suggest for inbetween periodic tasks */
  232. #define kSleepTimeForPeriodicTask        (60 * kOneSecondInTicks)
  233. /* •new•15 set this on if you want to support the CustomDeferredTask
  234.     function which allows you to have tasks processed when the
  235.     application is less busy */
  236. #define kCompileWithDeferredTask        0
  237.  
  238.  
  239. /***  MEMORY CONFIGURATION  ***/
  240.  
  241. /* You will need to estimate your memory requirements here */
  242.  
  243. /* 'comfort' zone of free memory. This must be big enough to allow
  244.     any essential functions to be called.
  245.     This is used as an 'emergency' reserve of memory to be
  246.     deallocated if seriously needed.
  247.     Named kMemCushion in IM-Memory: 1-43, 1-36 */
  248. #define kMemCushionSize            8192L /* 8k */
  249. /* for pre-allocation of master pointers.
  250.     Used in initAppMemory "Main.c"
  251.     IM-Memory: 1-42 */
  252. #define    kMoreMasterCalls        4
  253. /* minimum free space needed (in bytes) for application to be able to run.
  254.     Should probably be a multiple of 1024.
  255.     Should be bigger than kMemChusionSize */
  256. #define kMinSegSize                32768L /* 32k */
  257.  
  258.  
  259. /** COMPILING  **/
  260.  
  261. /* if you don't want to support the old function names that began
  262.     with 'My', then turn this option on. The names were changed because
  263.     people were wanting to keep the 'My' namespace for their custom code */
  264. #define kCompileWithout_MY_Names        1
  265.  
  266.  
  267. /**  PROFILER support  **/
  268.  
  269. /* max 21 chars in length.
  270.     End result will be something like "\p<name>-68K.prof" or "...-PPC.prof" */
  271. #define kProfileNameStr            "cgi"
  272.  
  273.  
  274. /**  LOGGING  **/
  275.  
  276. #define kCompileWithLogSupport            1
  277.  
  278.  
  279. /**  PREFERENCES  **/
  280.  
  281. /* •new•/15/ Include support for preferences handling */
  282. #define kCompileWithPreferences            1
  283.  
  284. #if kCompileWithPreferences
  285.  
  286. /* •new•/15/ Include support for a preferences file
  287.     (if not set on, the application/plug-in resource fork will be used) */
  288. #define kCompileWithPreferencesFile        1
  289.  
  290. /* •new•/15/ Include support for the preferences dialog */
  291. #define kCompileWithPreferencesDialog    1
  292.  
  293. #else
  294. #define kCompileWithPreferencesFile 0 /* don't touch */
  295. #define kCompileWithPreferencesDialog 0 /* don't touch */
  296. #endif
  297.  
  298.  
  299. /**  DEBUGGING Support  **/
  300.  
  301. /* •new•/15/  Turn this on if you want the debugging extras to be active */
  302. #define kCompileWithDebugging            1
  303.  
  304. #if kCompileWithDebugging
  305.  
  306. #if kCompileWithLogSupport /* logging required for these options */
  307.     /* cgi will log a number of actions to the log file */
  308.     #define kCompileWithDebugLogging    0
  309.     /* cgi will log error messages to the log file */
  310.     #define kCompileWithErrorLogging    0
  311. #else /* don't change these two lines */
  312.     #define kCompileWithDebugLogging 0 /* always off if logging off */
  313.     #define kCompileWithErrorLogging 0 /* always off if logging off */
  314. #endif
  315. /* if you are debugging your code, you should set assertions on (1).
  316.     If you are shipping your application, you should turn assertions off (0). */
  317. #define kCompileWithAssertions            1
  318. /* •new•/15/  If you are running QC from OnyxTech, then you may want to
  319.     turn on this option to get more stringent checking (additional tests
  320.     that you can't set from the QC control panel).
  321.     Do not turn this on unless you have QC.
  322.     You will need to add one of the QCAPI library files to your project. */
  323. #define kCompileWithExtraQC                0
  324.  
  325. #else /* if not kCompileWithDebugging - don't touch these */
  326. #define kCompileWithDebugLogging 0 /* don't touch */
  327. #define kCompileWithErrorLogging 0 /* don't touch */
  328. #define kCompileWithAssertions 0 /* don't touch */
  329. #define kCompileWithExtraQC 0 /* don't touch */
  330. #endif
  331.  
  332.  
  333. /**  MISCELLANEOUS  **/
  334.  
  335. /* If you are using Pascal for the custom functions (mixing C
  336.     and Pascal source files in a project) the C functions need to be
  337.     defined to support Pascal calling conventions. Set this option on
  338.     for Pascal calling conventions to be used (allowing you to call some
  339.     of the functions in the C source files from Pascal files. */
  340. #define kCompileWithPascalSupport        0
  341.  
  342. /* •new• set this to be your application creator type */
  343. #define kMyCreatorType                    'CGI?'
  344. /* •new•/15/  Max 31 char. Must be a unique ID for your CGI/plug-in */
  345. #define kMyCGIName                         "GRANT-DEMO-PLUGIN" 
  346.  
  347.  
  348. /***  PRIVATE SETTINGS  ***/
  349. /* !!! Please don't touch anything in this section */
  350.  
  351. #if (kStartupThreadsPreallocate < 1) && kCompileWithDeferredTask
  352. #error /* you must have at least one preallocated thread if you are going to use deferred tasks */
  353. #endif
  354. #if kCompileWithPreferencesFile && !(kCompileWithProcessFileSpec)
  355. #error "you must set kCompileWithProcessFileSpec to 1 if you are compiling with preferences file support"
  356. #endif
  357. #if kCompileWithMenuOptions && !(kCompileWithPreferencesFile)
  358. #error "you must set kCompileWithPreferencesFile to 1 if you are compiling with the option menu"
  359. #endif
  360. #if kCompileWithPascalSupport
  361.     #define p_export    pascal
  362. #else
  363.     #define p_export    
  364. #endif
  365.  
  366.  
  367. #endif /* __MYCONFIGURATION_H__ */
  368. /***  EOF  ***/
  369.